#ifndef _IIC_H
#define _IIC_H

#include "main.h"

#define I2C_OLED                HT_I2C1
#define OLED_SCL_AF_PORT        AFIO_PORT(A)
#define OLED_SCL_AF_PIN         AFIO_PIN(0)
#define OLED_SDA_AF_PORT        AFIO_PORT(A)
#define OLED_SDA_AF_PIN         AFIO_PIN(1)

#define I2C_OLED_ADDRESS        (0x78 >> 1)//地址需要右移1位
#define ClockSpeed              1000000

void iic_init(void);
void OLED_WR_Byte(uint8_t data,uint8_t mode);
//////////////////////////////////////////////////////////////////////////////
#define OLED_PORT               GPIO_PORT(A)
#define OLED_SCL_PIN            GPIO_PIN(0)
#define OLED_SDA_PIN            GPIO_PIN(1)
#define OLED_SCL_Clr()          GPIO_ClearOutBits(OLED_PORT,OLED_SCL_PIN)//SCL
#define OLED_SCL_Set()          GPIO_SetOutBits(OLED_PORT,OLED_SCL_PIN)
#define OLED_SDA_Clr()          GPIO_ClearOutBits(OLED_PORT,OLED_SDA_PIN)//DIN
#define OLED_SDA_Set()          GPIO_SetOutBits(OLED_PORT,OLED_SDA_PIN)

void Send_Byte(u8 dat);
void I2C_WaitAck(void);
void I2C_Stop(void);
void I2C_Start(void);

#endif
